Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper JSON Overhaul #224

Merged
merged 7 commits into from
Jan 30, 2024
Merged

Wrapper JSON Overhaul #224

merged 7 commits into from
Jan 30, 2024

Conversation

rooooooooob
Copy link
Collaborator

Wrapper newtypes will generate custom implementations that will defer to the inner type's JSON traits instead of deriving to get them. This gives us much nicer JSON implementations allowing directly T instead of { inner: T }.

Bytes newtypes will have a specialization that serializes to hex bytestring instead of the [number] array that would otherwise be used.

Introduces @custom_json comment DSL for newtypes that tell cddl-codegen to avoid generating/deriving any JSON traits under the assumption that some custom trait impls will be provided post-generation by the user.

Wrapper newtypes will generate custom implementations that will defer to
the inner type's JSON traits instead of deriving to get them.
This gives us much nicer JSON implementations allowing directly `T`
instead of `{ inner: T }`.

Bytes newtypes will have a specialization that serializes to hex
bytestring instead of the `[number]` array that would otherwise be used.

Introduces `@custom_json` comment DSL for newtypes that tell
cddl-codegen to avoid generating/deriving any JSON traits under the
assumption that some custom trait impls will be provided post-generation
by the user.
@rooooooooob rooooooooob merged commit 656c507 into master Jan 30, 2024
1 check passed
@rooooooooob rooooooooob deleted the wrapper-json-overhaul branch January 30, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants